#!/usr/bin/env python3
import os
import timm
import pandas as pd
from rich.console import Console
from rich.table import Table


if __name__ == '__main__':
    # print(dir(timm))
    models = timm.list_models()
    width = os.get_terminal_size().columns
    # for name in models:
    #     print(len(name), name)

    max_width = max([len(name) for name in models])
    # print(width, max_width)

    n = width // max_width + 1
    # print(n)
    name = {}
    for i in range(n):
        name['model%02d' % i] = models[i*max_width:(i+1)*max_width]

    pd.set_option('display.colheader_justify', 'center')

    df = pd.DataFrame(name)
    #print(df)
    console = Console()
    table = Table('pytorch image model')
    table.add_row(df.to_string())
    console.print(table)

   

